New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cache-header

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cache-header

Get and set the response cache header

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

cache-header

Get and set the response cache header

Install

npm install cache-header --save

Usage

var express = require('express');
var cacheHeader = require('cache-header');

var app = express();

app.use(function (req, res, next) {
  // Sets Cache-Control header to public, max-age=10000
  cacheHeader(res, 10000);
  next();
});

app.listen(3000, function () {
  
});

cacheHeader(responseObject, headerValue)

  • responseObject - the response object passed through by Node
  • headerValue - value to set the header to. Can be the following types:
    • false - sets value to no-cache
    • number - a number or a parseable string. Sets header to public, max-age={number}
    • string - sets the header to whatever the string is

Run Tests

npm install
npm test

Keywords

FAQs

Package last updated on 19 Nov 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc